package com.quasar.hpatient.model.medicalmodel;

import com.quasar.hpatient.utils.UrlUtils;

import java.io.Serializable;
import java.util.List;

/**
 * name : lishuai
 * time : 2017/11/1
 * title:
 */

public class SevenDayInspectionData implements Serializable {

    /**
     * msgCode : 0x00000000
     * list : [{"criticalValue":"12","inspectionIndex":{"eventId":0,"hospitalId":0,"testTime":"2017-10-27 11:43:23","id":1,"uploadTime":"2017-10-27 12:23:24","userId":3,"status":0},"itemValue":"13","standardValue":"12","doseName":"%","itemName":"肌酐","picList":[],"indexId":1,"attribute":1,"id":1,"inspectionName":"血常规","paramValue":"12"}]
     */

    private String msgCode;
    private List<ListBean> list;

    public String getMsgCode() {
        return msgCode;
    }

    public void setMsgCode(String msgCode) {
        this.msgCode = msgCode;
    }

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }

    public static class ListBean implements Serializable {

        /**
         * criticalValue : 12
         * inspectionIndex : {"eventId":0,"hospitalId":0,"testTime":"2017-10-27
         * 11:43:23","id":1,"uploadTime":"2017-10-27 12:23:24","userId":3,"status":0}
         * itemValue : 13
         * standardValue : 12
         * doseName : %
         * itemName : 肌酐
         * picList : []
         * indexId : 1
         * attribute : 1
         * id : 1
         * inspectionName : 血常规
         * paramValue : 12
         */

        private String criticalValue;  //危机值
        private InspectionIndexBean inspectionIndex;
        private String itemValue;   //化验值
        private String standardValue; //参考值
        private String doseName;   //单位
        private String itemName;   //化验项名称
        private int indexId;
        private int attribute;
        private int id;
        private String inspectionName;
        private String paramValue;  //附加值
        private List<?> picList;

        private float MaxValue;  //最大值
        private float MixValue;   //最小值

        /**
         * 0 代表无参考值
         * 1 代表只有最小值
         * 2 代表只有最大值
         * 3 代表有最大最小值
         */
        private int Status;   //状态

        int Maxstatus = 2;
        int Mixstatus = 1;
        int Nostatus = 0;
        int Allstatus = 3;

        public void Judgereference(String referenceValue) {

            if (referenceValue != null) {
                if (referenceValue.contains("-")) {
                    String[] reference = referenceValue.split("-");
                    if (reference.length == 2) {

                        if (UrlUtils.StrNum(reference[0]) && UrlUtils.StrNum(reference[1])) {
                            if (Float.parseFloat(reference[0]) == 0) {

                                setMaxValue(Float.parseFloat(reference[1]));
                                setStatus(Maxstatus);

                            } else {
                                setMaxValue(Float.parseFloat(reference[0]));
                                setMixValue(Float.parseFloat(reference[1]));
                                setStatus(Allstatus);
                            }

                        }
                    }
                } else if (referenceValue.contains("~")) {
                    String[] reference = referenceValue.split("~");
                    if (reference.length == 2) {
                        if (UrlUtils.StrNum(reference[0]) && UrlUtils.StrNum(reference[1])) {
                            setMaxValue(Float.parseFloat(reference[0]));
                            setMixValue(Float.parseFloat(reference[1]));
                            setStatus(Allstatus);
                        }
                    }
                } else if (referenceValue.contains("^")) {
                    String[] reference = referenceValue.split("^");
                    if (reference.length == 2) {
                        if (UrlUtils.StrNum(reference[0]) && UrlUtils.StrNum(reference[1])) {
                            setMaxValue(Float.parseFloat(reference[0]));
                            setMixValue(Float.parseFloat(reference[1]));
                            setStatus(Allstatus);
                        }
                    }
                } else if (referenceValue.contains("<")) {
                    String[] reference = referenceValue.split("<");
                    if (UrlUtils.StrNum(reference[1])) {
                        setMaxValue(Float.parseFloat(reference[1]));
                        setStatus(Maxstatus);
                    }

                } else if (referenceValue.contains("<=")) {
                    String[] reference = referenceValue.split("<");
                    if (UrlUtils.StrNum(reference[1])) {
                        setMaxValue(Float.parseFloat(reference[1]));
                        setStatus(Maxstatus);
                    }

                } else if (referenceValue.contains(">")) {
                    String[] reference = referenceValue.split("<");
                    if (UrlUtils.StrNum(reference[1])) {
                        setMaxValue(Float.parseFloat(reference[1]));
                        setStatus(Mixstatus);
                    }
                } else if (referenceValue.contains(">=")) {
                    String[] reference = referenceValue.split("<");
                    if (UrlUtils.StrNum(reference[1])) {
                        setMaxValue(Float.parseFloat(reference[1]));
                        setStatus(Mixstatus);
                    }
                } else {
                    setStatus(Nostatus);
                }
            } else {
                setStatus(Nostatus);
            }
        }


        public int getStatus() {
            return Status;
        }

        public void setStatus(int status) {
            Status = status;
        }

        public float getMixValue() {
            return MixValue;
        }

        public void setMixValue(float mixValue) {
            MixValue = mixValue;
        }

        public float getMaxValue() {
            return MaxValue;
        }

        public void setMaxValue(float maxValue) {
            MaxValue = maxValue;
        }

        public String getCriticalValue() {
            return criticalValue;
        }

        public void setCriticalValue(String criticalValue) {
            this.criticalValue = criticalValue;
        }

        public InspectionIndexBean getInspectionIndex() {
            return inspectionIndex;
        }

        public void setInspectionIndex(InspectionIndexBean inspectionIndex) {
            this.inspectionIndex = inspectionIndex;
        }

        public String getItemValue() {
            return itemValue;
        }

        public void setItemValue(String itemValue) {
            this.itemValue = itemValue;
        }

        public String getStandardValue() {
            return standardValue;
        }

        public void setStandardValue(String standardValue) {
            this.standardValue = standardValue;
        }

        public String getDoseName() {
            return doseName;
        }

        public void setDoseName(String doseName) {
            this.doseName = doseName;
        }

        public String getItemName() {
            return itemName;
        }

        public void setItemName(String itemName) {
            this.itemName = itemName;
        }

        public int getIndexId() {
            return indexId;
        }

        public void setIndexId(int indexId) {
            this.indexId = indexId;
        }

        public int getAttribute() {
            return attribute;
        }

        public void setAttribute(int attribute) {
            this.attribute = attribute;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getInspectionName() {
            return inspectionName;
        }

        public void setInspectionName(String inspectionName) {
            this.inspectionName = inspectionName;
        }

        public String getParamValue() {
            return paramValue;
        }

        public void setParamValue(String paramValue) {
            this.paramValue = paramValue;
        }

        public List<?> getPicList() {
            return picList;
        }

        public void setPicList(List<?> picList) {
            this.picList = picList;
        }

        public static class InspectionIndexBean {
            /**
             * eventId : 0
             * hospitalId : 0
             * testTime : 2017-10-27 11:43:23
             * id : 1
             * uploadTime : 2017-10-27 12:23:24
             * userId : 3
             * status : 0
             */

            private int eventId;
            private int hospitalId;
            private String testTime;
            private int id;
            private String uploadTime;
            private int userId;
            private int status;

            public int getEventId() {
                return eventId;
            }

            public void setEventId(int eventId) {
                this.eventId = eventId;
            }

            public int getHospitalId() {
                return hospitalId;
            }

            public void setHospitalId(int hospitalId) {
                this.hospitalId = hospitalId;
            }

            public String getTestTime() {
                return testTime;
            }

            public void setTestTime(String testTime) {
                this.testTime = testTime;
            }

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public String getUploadTime() {
                return uploadTime;
            }

            public void setUploadTime(String uploadTime) {
                this.uploadTime = uploadTime;
            }

            public int getUserId() {
                return userId;
            }

            public void setUserId(int userId) {
                this.userId = userId;
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }
        }
    }
}
